home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / QD3DViewer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  15.7 KB  |  532 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        QD3DViewer.h
  3.  
  4.      Contains:    MacOS Viewer Controller Interface File.                                
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.6
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1995-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DVIEWER__
  18. #define __QD3DVIEWER__
  19.  
  20. #ifndef __QD3D__
  21.     #include <QD3D.h>
  22. #endif
  23.  
  24. #ifndef __QD3DGROUP__
  25.     #include <QD3DGroup.h>
  26. #endif
  27.  
  28.  
  29. #if TARGET_OS_MAC
  30. #ifndef __EVENTS__
  31.     #include <Events.h>
  32. #endif
  33.  
  34. #ifndef __MACTYPES__
  35.     #include <MacTypes.h>
  36. #endif
  37.  
  38. #ifndef __QUICKDRAW__
  39.     #include <Quickdraw.h>
  40. #endif
  41.  
  42. #endif  /* TARGET_OS_MAC */
  43.  
  44.  
  45.  
  46. #if PRAGMA_ONCE
  47. #pragma once
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if PRAGMA_IMPORT
  55. #pragma import on
  56. #endif
  57.  
  58. #if PRAGMA_STRUCT_ALIGN
  59.     #pragma options align=power
  60. #elif PRAGMA_STRUCT_PACKPUSH
  61.     #pragma pack(push, 2)
  62. #elif PRAGMA_STRUCT_PACK
  63.     #pragma pack(2)
  64. #endif
  65.  
  66. #if PRAGMA_ENUM_ALWAYSINT
  67.     #pragma enumsalwaysint on
  68. #elif PRAGMA_ENUM_OPTIONS
  69.     #pragma option enum=int
  70. #elif PRAGMA_ENUM_PACK
  71.     #if __option(pack_enums)
  72.         #define PRAGMA_ENUM_PACK__QD3DVIEWER__
  73.     #endif
  74.     #pragma options(!pack_enums)
  75. #endif
  76.  
  77. typedef void *                            TQ3ViewerObject;
  78.  
  79. typedef CALLBACK_API_C( TQ3Status , TQ3ViewerWindowResizeCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  80. typedef CALLBACK_API_C( TQ3Status , TQ3ViewerPaneResizeNotifyCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  81.  
  82. #if TARGET_OS_MAC
  83. typedef CALLBACK_API_C( OSErr , TQ3ViewerDrawingCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  84.  
  85. enum {
  86.     kQ3ViewerShowBadge            = 1 << 0,
  87.     kQ3ViewerActive                = 1 << 1,
  88.     kQ3ViewerControllerVisible    = 1 << 2,
  89.     kQ3ViewerDrawFrame            = 1 << 3,
  90.     kQ3ViewerDraggingOff        = 1 << 4,
  91.     kQ3ViewerButtonCamera        = 1 << 5,
  92.     kQ3ViewerButtonTruck        = 1 << 6,
  93.     kQ3ViewerButtonOrbit        = 1 << 7,
  94.     kQ3ViewerButtonZoom            = 1 << 8,
  95.     kQ3ViewerButtonDolly        = 1 << 9,
  96.     kQ3ViewerButtonReset        = 1 << 10,
  97.     kQ3ViewerOutputTextMode        = 1 << 11,
  98.     kQ3ViewerDragMode            = 1 << 12,
  99.     kQ3ViewerDrawGrowBox        = 1 << 13,
  100.     kQ3ViewerDrawDragBorder        = 1 << 14,
  101.     kQ3ViewerDraggingInOff        = 1 << 15,
  102.     kQ3ViewerDraggingOutOff        = 1 << 16,
  103.     kQ3ViewerButtonOptions        = 1 << 17,
  104.     kQ3ViewerPaneGrowBox        = 1 << 18,
  105.     kQ3ViewerDefault            = 1 << 31
  106. };
  107.  
  108. enum {
  109.     kQ3ViewerEmpty                = 0,
  110.     kQ3ViewerHasModel            = 1 << 0,
  111.     kQ3ViewerHasUndo            = 1 << 1
  112. };
  113.  
  114.  
  115. enum TQ3ViewerCameraView {
  116.     kQ3ViewerCameraRestore        = 0,
  117.     kQ3ViewerCameraFit            = 1,
  118.     kQ3ViewerCameraFront        = 2,
  119.     kQ3ViewerCameraBack            = 3,
  120.     kQ3ViewerCameraLeft            = 4,
  121.     kQ3ViewerCameraRight        = 5,
  122.     kQ3ViewerCameraTop            = 6,
  123.     kQ3ViewerCameraBottom        = 7
  124. };
  125. typedef enum TQ3ViewerCameraView TQ3ViewerCameraView;
  126.  
  127.  
  128.  
  129.  
  130. /******************************************************************************
  131.  **                                                                             **
  132.  **        Return viewer version number                                         **
  133.  **                                                                             **
  134.  *****************************************************************************/
  135. EXTERN_API_C( OSErr )
  136. Q3ViewerGetVersion                (unsigned long *        majorRevision,
  137.                                  unsigned long *        minorRevision);
  138.  
  139.  
  140. /******************************************************************************
  141.  **                                                                             **
  142.  **        Return viewer release version number                                 **
  143.  **        (in 'vers' format - e.g. 0x01518000 ==> 1.5.1 release)                 **
  144.  **                                                                             **
  145.  *****************************************************************************/
  146. EXTERN_API_C( OSErr )
  147. Q3ViewerGetReleaseVersion        (unsigned long *        releaseRevision);
  148.  
  149.  
  150. /******************************************************************************
  151.  **                                                                             **
  152.  **                        Creation and destruction                             **
  153.  **                Note that this is not a QuickDraw 3D object                     **
  154.  **                                                                             **
  155.  *****************************************************************************/
  156. EXTERN_API_C( TQ3ViewerObject )
  157. Q3ViewerNew                        (CGrafPtr                 port,
  158.                                  Rect *                    rect,
  159.                                  unsigned long             flags);
  160.  
  161. EXTERN_API_C( OSErr )
  162. Q3ViewerDispose                    (TQ3ViewerObject         theViewer);
  163.  
  164.  
  165. /******************************************************************************
  166.  **                                                                             **
  167.  **                    Functions to attach data to a viewer                     **
  168.  **                                                                             **
  169.  *****************************************************************************/
  170. EXTERN_API_C( OSErr )
  171. Q3ViewerUseFile                    (TQ3ViewerObject         theViewer,
  172.                                  long                     refNum);
  173.  
  174. EXTERN_API_C( OSErr )
  175. Q3ViewerUseData                    (TQ3ViewerObject         theViewer,
  176.                                  void *                    data,
  177.                                  long                     size);
  178.  
  179.  
  180. /******************************************************************************
  181.  **                                                                             **
  182.  **        Functions to write data out from the Viewer                             **
  183.  **                                                                             **
  184.  *****************************************************************************/
  185. EXTERN_API_C( OSErr )
  186. Q3ViewerWriteFile                (TQ3ViewerObject         theViewer,
  187.                                  long                     refNum);
  188.  
  189. EXTERN_API_C( unsigned long )
  190. Q3ViewerWriteData                (TQ3ViewerObject         theViewer,
  191.                                  Handle                 data);
  192.  
  193.  
  194. /******************************************************************************
  195.  **                                                                             **
  196.  **        Use this function to force the Viewer to re-draw                     **
  197.  **                                                                             **
  198.  *****************************************************************************/
  199. EXTERN_API_C( OSErr )
  200. Q3ViewerDraw                    (TQ3ViewerObject         theViewer);
  201.  
  202. EXTERN_API_C( OSErr )
  203. Q3ViewerDrawContent                (TQ3ViewerObject         theViewer);
  204.  
  205. EXTERN_API_C( OSErr )
  206. Q3ViewerDrawControlStrip        (TQ3ViewerObject         theViewer);
  207.  
  208.  
  209. /******************************************************************************
  210.  **                                                                             **
  211.  **        Function used by the Viewer to filter and handle events                 **
  212.  **                                                                             **
  213.  *****************************************************************************/
  214. EXTERN_API_C( Boolean )
  215. Q3ViewerEvent                    (TQ3ViewerObject         theViewer,
  216.                                  EventRecord *            evt);
  217.  
  218.  
  219. /******************************************************************************
  220.  **                                                                             **
  221.  **        This function returns a PICT of the contents of the                  **
  222.  **        Viewer's window.  The application should dispose the PICT.             **
  223.  **                                                                             **
  224.  *****************************************************************************/
  225. EXTERN_API_C( PicHandle )
  226. Q3ViewerGetPict                    (TQ3ViewerObject         theViewer);
  227.  
  228.  
  229. /******************************************************************************
  230.  **                                                                             **
  231.  **                        Calls for dealing with Buttons                         **
  232.  **                                                                             **
  233.  *****************************************************************************/
  234. EXTERN_API_C( OSErr )
  235. Q3ViewerGetButtonRect            (TQ3ViewerObject         theViewer,
  236.                                  unsigned long             button,
  237.                                  Rect *                    rect);
  238.  
  239. EXTERN_API_C( unsigned long )
  240. Q3ViewerGetCurrentButton        (TQ3ViewerObject         theViewer);
  241.  
  242. EXTERN_API_C( OSErr )
  243. Q3ViewerSetCurrentButton        (TQ3ViewerObject         theViewer,
  244.                                  unsigned long             button);
  245.  
  246.  
  247. /******************************************************************************
  248.  **                                                                             **
  249.  **        Functions to set/get the group to be displayed by the Viewer.         **
  250.  **                                                                             **
  251.  *****************************************************************************/
  252. EXTERN_API_C( OSErr )
  253. Q3ViewerUseGroup                (TQ3ViewerObject         theViewer,
  254.                                  TQ3GroupObject         group);
  255.  
  256. EXTERN_API_C( TQ3GroupObject )
  257. Q3ViewerGetGroup                (TQ3ViewerObject         theViewer);
  258.  
  259.  
  260. /******************************************************************************
  261.  **                                                                             **
  262.  **        Functions to set/get the color used to clear the window                 **
  263.  **                                                                             **
  264.  *****************************************************************************/
  265. EXTERN_API_C( OSErr )
  266. Q3ViewerSetBackgroundColor        (TQ3ViewerObject         theViewer,
  267.                                  TQ3ColorARGB *            color);
  268.  
  269. EXTERN_API_C( OSErr )
  270. Q3ViewerGetBackgroundColor        (TQ3ViewerObject         theViewer,
  271.                                  TQ3ColorARGB *            color);
  272.  
  273.  
  274. /******************************************************************************
  275.  **                                                                             **
  276.  **        Getting/Setting a Viewer's View object.                                 **
  277.  **                                                                             **
  278.  *****************************************************************************/
  279. EXTERN_API_C( TQ3ViewObject )
  280. Q3ViewerGetView                    (TQ3ViewerObject         theViewer);
  281.  
  282. EXTERN_API_C( OSErr )
  283. Q3ViewerRestoreView                (TQ3ViewerObject         theViewer);
  284.  
  285.  
  286. /******************************************************************************
  287.  **                                                                             **
  288.  **        Calls for setting/getting viewer flags                                 **
  289.  **                                                                             **
  290.  *****************************************************************************/
  291. EXTERN_API_C( OSErr )
  292. Q3ViewerSetFlags                (TQ3ViewerObject         theViewer,
  293.                                  unsigned long             flags);
  294.  
  295. EXTERN_API_C( unsigned long )
  296. Q3ViewerGetFlags                (TQ3ViewerObject         theViewer);
  297.  
  298.  
  299. /******************************************************************************
  300.  **                                                                             **
  301.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  302.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  303.  **        or the current dimensions of the window (if you do a Set).             **
  304.  **                                                                             **
  305.  *****************************************************************************/
  306. EXTERN_API_C( OSErr )
  307. Q3ViewerSetBounds                (TQ3ViewerObject         theViewer,
  308.                                  Rect *                    bounds);
  309.  
  310. EXTERN_API_C( OSErr )
  311. Q3ViewerGetBounds                (TQ3ViewerObject         theViewer,
  312.                                  Rect *                    bounds);
  313.  
  314. EXTERN_API_C( OSErr )
  315. Q3ViewerSetDimension            (TQ3ViewerObject         theViewer,
  316.                                  unsigned long             width,
  317.                                  unsigned long             height);
  318.  
  319. EXTERN_API_C( OSErr )
  320. Q3ViewerGetDimension            (TQ3ViewerObject         theViewer,
  321.                                  unsigned long *        width,
  322.                                  unsigned long *        height);
  323.  
  324. EXTERN_API_C( OSErr )
  325. Q3ViewerGetMinimumDimension        (TQ3ViewerObject         theViewer,
  326.                                  unsigned long *        width,
  327.                                  unsigned long *        height);
  328.  
  329.  
  330. /******************************************************************************
  331.  **                                                                             **
  332.  **                            Port related calls                                 **
  333.  **                                                                             **
  334.  *****************************************************************************/
  335. EXTERN_API_C( OSErr )
  336. Q3ViewerSetPort                    (TQ3ViewerObject         theViewer,
  337.                                  CGrafPtr                 port);
  338.  
  339. EXTERN_API_C( CGrafPtr )
  340. Q3ViewerGetPort                    (TQ3ViewerObject         theViewer);
  341.  
  342.  
  343. /******************************************************************************
  344.  **                                                                             **
  345.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  346.  **        to change the cursor according to the cursor position/object under     **
  347.  **        the cursor.                                                             **
  348.  **                                                                             **
  349.  *****************************************************************************/
  350. EXTERN_API_C( Boolean )
  351. Q3ViewerAdjustCursor            (TQ3ViewerObject         theViewer,
  352.                                  Point *                pt);
  353.  
  354. EXTERN_API_C( OSErr )
  355. Q3ViewerCursorChanged            (TQ3ViewerObject         theViewer);
  356.  
  357.  
  358. /******************************************************************************
  359.  **                                                                             **
  360.  **        Returns the state of the viewer.  See the constant defined at the     **
  361.  **        top of this file.                                                     **
  362.  **                                                                             **
  363.  *****************************************************************************/
  364. EXTERN_API_C( unsigned long )
  365. Q3ViewerGetState                (TQ3ViewerObject         theViewer);
  366.  
  367.  
  368. /******************************************************************************
  369.  **                                                                             **
  370.  **                            Clipboard utilities                                 **
  371.  **                                                                             **
  372.  *****************************************************************************/
  373. EXTERN_API_C( OSErr )
  374. Q3ViewerClear                    (TQ3ViewerObject         theViewer);
  375.  
  376. EXTERN_API_C( OSErr )
  377. Q3ViewerCut                        (TQ3ViewerObject         theViewer);
  378.  
  379. EXTERN_API_C( OSErr )
  380. Q3ViewerCopy                    (TQ3ViewerObject         theViewer);
  381.  
  382. EXTERN_API_C( OSErr )
  383. Q3ViewerPaste                    (TQ3ViewerObject         theViewer);
  384.  
  385.  
  386. /******************************************************************************
  387.  **                                                                             **
  388.  **                            New Event Model                                     **
  389.  **                                                                             **
  390.  *****************************************************************************/
  391. EXTERN_API_C( Boolean )
  392. Q3ViewerMouseDown                (TQ3ViewerObject         theViewer,
  393.                                  long                     x,
  394.                                  long                     y);
  395.  
  396. EXTERN_API_C( Boolean )
  397. Q3ViewerContinueTracking        (TQ3ViewerObject         theViewer,
  398.                                  long                     x,
  399.                                  long                     y);
  400.  
  401. EXTERN_API_C( Boolean )
  402. Q3ViewerMouseUp                    (TQ3ViewerObject         theViewer,
  403.                                  long                     x,
  404.                                  long                     y);
  405.  
  406. EXTERN_API_C( Boolean )
  407. Q3ViewerHandleKeyEvent            (TQ3ViewerObject         theViewer,
  408.                                  EventRecord *            evt);
  409.  
  410.  
  411. /******************************************************************************
  412.  **                                                                             **
  413.  **                                    CallBacks                                 **
  414.  **                                                                             **
  415.  *****************************************************************************/
  416. EXTERN_API_C( OSErr )
  417. Q3ViewerSetDrawingCallbackMethod (TQ3ViewerObject         theViewer,
  418.                                  TQ3ViewerDrawingCallbackMethod  callbackMethod,
  419.                                  const void *            data);
  420.  
  421. EXTERN_API_C( OSErr )
  422. Q3ViewerSetWindowResizeCallback    (TQ3ViewerObject         theViewer,
  423.                                  TQ3ViewerWindowResizeCallbackMethod  windowResizeCallbackMethod,
  424.                                  const void *            data);
  425.  
  426. EXTERN_API_C( OSErr )
  427. Q3ViewerSetPaneResizeNotifyCallback (TQ3ViewerObject     theViewer,
  428.                                  TQ3ViewerPaneResizeNotifyCallbackMethod  paneResizeNotifyCallbackMethod,
  429.                                  const void *            data);
  430.  
  431.  
  432. /******************************************************************************
  433.  **                                                                             **
  434.  **                                    Undo                                     **
  435.  **                                                                             **
  436.  *****************************************************************************/
  437. EXTERN_API_C( OSErr )
  438. Q3ViewerUndo                    (TQ3ViewerObject         theViewer);
  439.  
  440. EXTERN_API_C( Boolean )
  441. Q3ViewerGetUndoString            (TQ3ViewerObject         theViewer,
  442.                                  char *                    str,
  443.                                  unsigned long *        cnt);
  444.  
  445.  
  446. /******************************************************************************
  447.  **                                                                             **
  448.  **                                Camera Support                                 **
  449.  **                                                                             **
  450.  *****************************************************************************/
  451. EXTERN_API_C( OSErr )
  452. Q3ViewerGetCameraCount            (TQ3ViewerObject         theViewer,
  453.                                  unsigned long *        cnt);
  454.  
  455. EXTERN_API_C( OSErr )
  456. Q3ViewerSetCameraByNumber        (TQ3ViewerObject         theViewer,
  457.                                  unsigned long             cameraNo);
  458.  
  459. EXTERN_API_C( OSErr )
  460. Q3ViewerSetCameraByView            (TQ3ViewerObject         theViewer,
  461.                                  TQ3ViewerCameraView     viewType);
  462.  
  463.  
  464. /******************************************************************************
  465.  **                                                                             **
  466.  **                            Pop-up Button Options                             **
  467.  **                                                                             **
  468.  *****************************************************************************/
  469. EXTERN_API_C( OSErr )
  470. Q3ViewerSetRendererType            (TQ3ViewerObject         theViewer,
  471.                                  TQ3ObjectType             rendererType);
  472.  
  473. EXTERN_API_C( OSErr )
  474. Q3ViewerGetRendererType            (TQ3ViewerObject         theViewer,
  475.                                  TQ3ObjectType *        rendererType);
  476.  
  477. EXTERN_API_C( OSErr )
  478. Q3ViewerChangeBrightness        (TQ3ViewerObject         theViewer,
  479.                                  float                     brightness);
  480.  
  481. EXTERN_API_C( OSErr )
  482. Q3ViewerSetRemoveBackfaces        (TQ3ViewerObject         theViewer,
  483.                                  TQ3Boolean             remove);
  484.  
  485. EXTERN_API_C( OSErr )
  486. Q3ViewerGetRemoveBackfaces        (TQ3ViewerObject         theViewer,
  487.                                  TQ3Boolean *            remove);
  488.  
  489. EXTERN_API_C( OSErr )
  490. Q3ViewerSetPhongShading            (TQ3ViewerObject         theViewer,
  491.                                  TQ3Boolean             phong);
  492.  
  493. EXTERN_API_C( OSErr )
  494. Q3ViewerGetPhongShading            (TQ3ViewerObject         theViewer,
  495.                                  TQ3Boolean *            phong);
  496.  
  497.  
  498. #endif  /* TARGET_OS_MAC */
  499.  
  500.  
  501.  
  502.  
  503.  
  504. #if PRAGMA_ENUM_ALWAYSINT
  505.     #pragma enumsalwaysint reset
  506. #elif PRAGMA_ENUM_OPTIONS
  507.     #pragma option enum=reset
  508. #elif defined(PRAGMA_ENUM_PACK__QD3DVIEWER__)
  509.     #pragma options(pack_enums)
  510. #endif
  511.  
  512. #if PRAGMA_STRUCT_ALIGN
  513.     #pragma options align=reset
  514. #elif PRAGMA_STRUCT_PACKPUSH
  515.     #pragma pack(pop)
  516. #elif PRAGMA_STRUCT_PACK
  517.     #pragma pack()
  518. #endif
  519.  
  520. #ifdef PRAGMA_IMPORT_OFF
  521. #pragma import off
  522. #elif PRAGMA_IMPORT
  523. #pragma import reset
  524. #endif
  525.  
  526. #ifdef __cplusplus
  527. }
  528. #endif
  529.  
  530. #endif /* __QD3DVIEWER__ */
  531.  
  532.